package com.zhuhjay.common.core.security.handler;

import com.zhuhjay.common.base.model.vo.HttpResult;
import com.zhuhjay.common.web.util.ServletUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ZhuHJay
 * @date 2023/3/5 11:15
 */
@Slf4j
public class CustomerLogoutSuccessHandler implements LogoutSuccessHandler {

    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
        ServletUtils.writeToJson(response, HttpResult.ok("登出成功"));
    }

}
